﻿namespace FileService.Infrastructure.Repository;

public class FSRepository : IFSRepository
{
    private readonly FileDbContext dbContext;

    public FSRepository(FileDbContext dbContext)
    {
        this.dbContext = dbContext;
    }

    public Task<UploadedItem?> FindFileAsync(long fileSize, string sha256Hash)
    {
        return dbContext.UploadItems.FirstOrDefaultAsync(u => u.FileSizeInBytes == fileSize
                                                              && u.FileSHA256Hash == sha256Hash);
    }
}